package com.cabal.exchange.dao;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.cabal.common.constants.SystemConstants;
import com.cabal.config.DS;
import com.cabal.exchange.entity.ItemExchange;
import com.cabal.war.entity.CabalLordOfWarPoint;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;
import java.util.Map;

@Mapper
public interface ItemExchangeMapper extends BaseMapper<ItemExchange> {

    @DS(value = SystemConstants.DS_KEY_SERVER01)
    int countMailReceived();

    @DS(value = SystemConstants.DS_KEY_SERVER01)
    List<ItemExchange> searchItemExchangeList();

    void execSendReward(Map<String, Object> params);

    /**
     * 扣除元宝
     *
     * @param userNum
     * @param cash
     */
    @DS(value = SystemConstants.DS_KEY_CABALCASH)
    void deductionCashAccount(@Param("userNum") Integer userNum, @Param("cash") Integer cash);

    @DS(value = SystemConstants.DS_KEY_CABALCASH)
    Integer getSenderTotalCash(@Param("userNum") Integer userNum);

    @DS(value = SystemConstants.DS_KEY_SERVER01)
    void batchUpdateMailReceivedState(@Param("itemExchangeList") List<ItemExchange> itemExchangeList);

    @DS(value = SystemConstants.DS_KEY_SERVER01)
    int countMailReceivedAndRead();

    @DS(value = SystemConstants.DS_KEY_SERVER01)
    int clearMailReadData();
}
